package com.gagakuai.statement;

import com.gagakuai.session.ResultHandler;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

/*
 * @program: common-starters
 * @description: 封装jdbc的statement
 * @author: houhong
 * @create: 2023-06-30 20:48
 */
public interface StatementHandler {

    /*
     * @param transactionTTimeout:事务超时时间
     * @param connection:连接
     * @return {@link Statement}
     * @Author houhong
     * @Description //TODO
     * @Date 9:16 下午 2023/7/1
     */
    Statement prepare(Connection connection, Integer transactionTTimeout);

    void parameterize(Statement statement)
            throws SQLException;

    /*
     * @param resultHandler:处理器
     * @param statement:        statement
     * @return {@link E}
     * @Author houhong
     * @Description //TODO
     * @Date 9:27 下午 2023/7/1
     */
    <E> E query(Statement statement, ResultHandler resultHandler) throws SQLException;
}